﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
using Utility;

namespace Web.giaovien
{
    public partial class UCPhanCong : System.Web.UI.UserControl
    {
        PhanCongControl pcCtr = new PhanCongControl();
        XepPhongControl xpCtr = new XepPhongControl();
        LichControl lichCtr = new LichControl();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadPhanCong();
                GridView3.Visible = false;
            }
        }

        private void LoadPhanCong()
        {
            GridView1.DataSource = pcCtr.GetListPhanCong();
            GridView1.DataBind();
        }

        protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {
            GridView3.Visible = true;
            int id = Int32.Parse( WebHelper.GetIdGridView(GridView1 , 0 , e).ToString());
            GridView3.DataSource = lichCtr.GetLichByPCID(id);
            GridView3.DataBind();
        }
    }
}